package com.njtoyo.taxi.admin.rest.presenter.business.ride;

import com.njtoyo.taxi.admin.library.common.GeoPoint;
import com.njtoyo.taxi.admin.mapper.master.entity.CallPayment;
import com.njtoyo.taxi.admin.mapper.master.entity.DesignatedCall;
import com.njtoyo.taxi.admin.mapper.master.entity.SuspiciousRide;
import com.njtoyo.taxi.admin.mapper.master.enums.*;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

@Data
public class DesignatedRideDetailPresenter implements Serializable {
    private Long id;
    private Long rideId;
    private String callOriginName;
    private String callDestinationName;
    private String originName;
    private String destinationName;
    private String state;
    private RidePlatform platform;
    private DesignatedRideCategory category;
    private Date createdAt;
    private Date updatedAt;

    private GeoPoint callOrigin;
    private GeoPoint callDestination;
    private GeoPoint origin;
    private GeoPoint destination;
    private Date estimatedPickupAt;
    private Long distance;


    private SuspiciousRide suspiciousRide;
    private Taxi taxi;

    private List<RideStateLog> rideStateLog;

    @Data
    public static class RideStateLog {
        private DesignatedRideState state;
        private GeoPoint locate;
        private Date createdAt;
    }

    @Data
    public static class Taxi {
        private Long id;
        private String plateNumber;
    }

    private Driver driver;

    @Data
    public static class Driver {
        private Long id;
        private String name;
        private String mobileNumber;
    }

    private User user;

    @Data
    public static class User {
        private Long id;
        private String name;
        private String mobileNumber;
    }

    private Company company;

    @Data
    public static class Company {
        private Long id;
        private String name;
    }

    private Area area;

    @Data
    public static class Area {
        private Long id;
        private String name;
    }

    private City city;

    @Data
    public static class City {
        private Long id;
        private String name;
    }

    private Canton canton;

    @Data
    public static class Canton {
        private Long id;
        private String name;
    }

    private RideOrder rideOrder;

    @Data
    public static class RideOrder {
        private Long id;
        private String number;
        private String outTradeNumber;
        private BigDecimal amount;
        @ApiModelProperty(value = "实际所得")
        private BigDecimal actualAmount;
        private BigDecimal customerFarePaid;
        @ApiModelProperty(value = "加价")
        private Integer priceMarkup;
        private RideOrderPaidThrough presetThrough;
        private RideOrderPaidThrough paidThrough;
        private RideOrderState state;
        private Boolean refunded;
        private BigDecimal balancePaid;
        @ApiModelProperty(value = "活动实际补贴金额（如果优惠券、余额抵扣之后金额为0，记录0；如果抵扣之后金额为0.8,当前补贴为1，记录0.8")
        private BigDecimal allowanceAmount;
        private Date createdAt;
        private Date updatedAt;
        private Coupon coupon;
        private CallPayment callPayment;

        /**
         * 计价器费用
         */
        private BigDecimal taxiFee;

        /**
         * 过路过桥费
         */
        private BigDecimal tollFee;

        /**
         * 额外费用
         */
        private BigDecimal otherFee;
    }

    @Data
    public static class Coupon {
        private Long id;
        @ApiModelProperty(value = "0:mix,1:reduction,2:fullreduction,3:discount")
        private CouponCategory category;
        private Double digit;
        private String limitation;
    }


    private RideCancellation rideCancellation;

    @Data
    public static class RideCancellation {
        private Long id;
        private RideCancellationTriggerBy triggerBy;
        private RideCancellationResponsibility responsibility;
        private RideCancellationViolate violate;
        private Date createdAt;
        private Date updatedAt;
        private CancellationOrder cancellationOrder;
        private DriverScoreDeduct driverScoreDeduct;
    }

    @Data
    public static class CancellationOrder {
        private Long id;
        private String number;
        private String outTradeNumber;
        private BigDecimal amount;
        private RideOrderPaidThrough paidThrough;
        private BigDecimal farePaid;
        private BigDecimal balancePaid;
        private RideOrderState state;
        private Boolean refunded;
        private Date createdAt;
        private Date updatedAt;
    }

    @Data
    public static class DriverScoreDeduct {
        private Long id;
        private Integer deduction;
        private Date startedAt;
        private Date endedAt;
    }

    private CustomerCancelReasonLog customerCancelReasonLog;

    @Data
    public static class CustomerCancelReasonLog {
        private Long id;

        @ApiModelProperty(value = "取消的原因")
        private String reason;

        @ApiModelProperty(value = "创建时间")
        private Date createdAt;

        @ApiModelProperty(value = "修改时间")
        private Date updatedAt;

        private ReasonOption reasonOption;
    }

    @Data
    public static class ReasonOption {
        private Long id;

        @ApiModelProperty(value = "取消原因的类型 0:system[系统原因],1:driver[司机原因],2:customer[乘客自身原因],3:other[其他原因]")
        private CustomerCancelReasonOptionCategory category;

        @ApiModelProperty(value = "取消的原因")
        private String reason;
    }

    private RideMarking rideMarking;

    @Data
    public static class RideMarking {
        private Integer score;

        @ApiModelProperty(value = "评价内容")
        private String comment;

        private List<RideMarkingTag> rideMarkingTag;

        private Date createdAt;
    }

    @Data
    public static class RideMarkingTag {
        private Long id;

        @ApiModelProperty(value = "评价内容")
        private String title;

        @ApiModelProperty(value = "0:goodmark,1:badmark,2:unknown")
        private TagCategory category;
    }

    private DesignatedCall callInfo;

    @Data
    public static class RealtimeCall {
        private Long id;
        private GeoPoint origin;
        private String originName;
        private String originPlaceName;
        private GeoPoint destination;
        private String destinationName;
        private String destinationPlaceName;
        private Integer priceMarkup;
        private Integer distance;
        private AppointmentCallState state;
        private Date pickUpTime;
        private Date createdAt;
        private Date updatedAt;
    }

    @Data
    public static class AppointmentCall {
        private Long id;
        private GeoPoint origin;
        private String originName;
        private String originPlaceName;
        private GeoPoint destination;
        private String destinationName;
        private String destinationPlaceName;
        private Integer priceMarkup;
        private Integer distance;
        private AppointmentCallState state;
        private AppointmentCallCategory category;
        private Date scheduleTime;
        private Date pickUpTime;
        private Date createdAt;
        private Date updatedAt;
    }


}
